﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Kaiser.Domains;

namespace Kaiser.Modules.Core.Aggregates
{
    /// <summary>
    /// 结算账户
    /// </summary>
    public class SettleAcct : EntityBase<SettleAcct>
    {
        public SettleAcct()
        {

        }

        public string SettleAcctName { get; set; }
        public string SearchCode { get; set; }
        public string BankName { get; set; }
        public string BankNo { get; set; }

        //public string SettleAcctType
        //{
        //    get;
        //    set;
        //}

        public double InitAmount
        {
            get;
            set;
        }

        public double CurAmount
        {
            get;
            set;
        }

        public bool IsSystem
        {
            get;
            set;
        }
        public bool IsDisable
        {
            get;
            set;
        }

        public bool IsDelete
        {
            get;
            set;
        }

        public bool SyncState
        {
            get;
            set;
        }

        public string UserId
        {
            get;
            set;
        }

        public string UserName { get; set; }

        public DateTime? CreaDateTime { get; set; }

        public DateTime? LastUpdateDateTime { get; set; }

        public string Remark { get; set; }


        public void UpdateCurAmount(double money)
        {
            //todo 更新当前的结算账户的数额
            this.CurAmount = money;
        }

        public static SettleAcct GetSettleAcctByName(string name)
        {
           
            return List.FirstOrDefault(x => x.SettleAcctName == name);
        }

        //public void AddCurAmount(double money)
        //{

        //}
    }
}
